package com.zqh.myfmmall.vo;

import com.zqh.myfmmall.entity.Product;
import com.zqh.myfmmall.entity.ProductSku;
import com.zqh.myfmmall.entity.ShoppingCart;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 新增 productName、productImg
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShoppingCartVO {
    private String cartId;
    private String productId;
    private String skuId;
    private String userId;
    private Integer cartNum;
    private LocalDateTime createTime;
    private BigDecimal addedPrice;
    private String skuProps;

    private String productName;
    private String productImg;
    private BigDecimal originalPrice;
    private BigDecimal sellPrice;
    private String skuName;
    private int skuStock;  //库存

    public ShoppingCartVO(ShoppingCart shoppingCart, ProductSku productSku, Product product,String productImg){
        this.cartId = shoppingCart.getCartId();
        this.productId = shoppingCart.getProductId();
        this.skuId = shoppingCart.getSkuId();
        this.userId = shoppingCart.getUserId();
        this.cartNum = shoppingCart.getCartNum();
        this.createTime = shoppingCart.getCreateTime();
        this.addedPrice = shoppingCart.getAddedPrice();
        this.skuProps = productSku.getProps();
        this.productName = product.getProductName();
        this.productImg = productImg;
        this.sellPrice = productSku.getSellPrice();
        this.originalPrice = productSku.getOriginalPrice();
        this.skuName = productSku.getSkuName();
        this.skuStock = productSku.getStock();
    }
}

